package demo1;

class Students{


    public void test(){
        System.out.println("test::Students");
    }

}

interface IA{
    void testA();
}

public class Test {
    public static void func(){
        new IA(){
            @Override
            public void testA() {
                System.out.println("testA()");
            }
        }.testA();
    }

        public static void func1(){
            //匿名类部类：
            Students students = new Students(){
                @Override
                public void test() {
                    System.out.println("重写 test() 方法");
                }
            };
            students.test();
        }

    public static void main(String[] args) {
        func();
    }

}
